#import "Liu70TimeShowLabel.h"
@implementation Liu70TimeShowLabel
- (void)setTimeStamp:(NSNumber *)timeStamp {
    _timeStamp = timeStamp;
    self.text = [self compareCurrentTimeStamp:timeStamp];
}
- (NSString *)compareCurrentTimeStamp:(NSNumber *)timeStamp {
    NSDate *compareDate = [NSDate dateWithTimeIntervalSince1970:timeStamp.doubleValue];
    NSTimeInterval timeInterval = [compareDate timeIntervalSinceNow];
    timeInterval = -timeInterval;
    long temp = 0;
    NSString *result;
    if (timeInterval < 60) {
        result = [NSString stringWithFormat:@"%@", ASLocalizedString(@"刚刚")];
    }
    else if((temp = timeInterval/60) <60){
        result = [NSString stringWithFormat:@"%ld%@",temp, ASLocalizedString(@"分钟前")];
    }
    else if((temp = temp/60) <24){
        result = [NSString stringWithFormat:@"%ld%@",temp, ASLocalizedString(@"小时前")];
    }
    else if((temp = temp/24) <30){
        result = [NSString stringWithFormat:@"%ld%@",temp, ASLocalizedString(@"天前")];
    }
    else if((temp = temp/30) <12){
        result = [NSString stringWithFormat:@"%ld%@",temp, ASLocalizedString(@"月前")];
    }
    else{
        temp = temp/12;
        result = [NSString stringWithFormat:@"%ld%@",temp, ASLocalizedString(@"年前")];
    }
    return  result;
}
@end
